How to manage primary key while updating [migrated]
Posted
by
Subin Jacob
on Programmers
See other posts from Programmers
or by Subin Jacob
Published on 2013-10-25T13:30:39Z
Indexed on
2013/10/25
16:10 UTC
Read the original article
Hit count: 394
In the following table primaryKeyColumn
is primary key.
To maintain the data history I always uses the values with WHERE
condition(WHERE StatusColumn=1
) And will set the StatusColumn to 0 if the data is edited (So that I could keep the previous data).
But the problem is, if I update it to 0 , I can't insert the same key to primarykeycolumn since the column validated for primary keys. How can I manage these kind of validations? what the mistake I did in this design?
primaryKeyColumn ValueColumn StatusColumn
---------------- ----------- ------------
2 Name1 1
3 Name2 1
4 Name3 0
© Programmers or respective owner